//品牌管理模块接口
//@ts-ignore
import request from "@/utils/request";
import type { TradeMark, TradeMarkResponseData } from "./type";
enum API {
  TRADEMARK_URL = "/admin/product/baseTrademark/",
  ADDTRADEMARK_URL = "/admin/product/baseTrademark/save",
  UPDATETRADEMARK_URL = "/admin/product/baseTrademark/update",
  DELETETRADEMARK_URL = "/admin/product/baseTrademark/remove/",
}
export const reqHasTrademark = (page: number, limit: number) =>
  request.get<any, TradeMarkResponseData>(
    API.TRADEMARK_URL + `${page}/${limit}`,
  );

export const reqAddOrUpdateTrademark = (trademark: TradeMark) => {
  if (trademark.id) {
    // 修改
    return request.put<any, any>(API.UPDATETRADEMARK_URL, trademark);
  } else {
    // 新增
    return request.post<any, any>(API.ADDTRADEMARK_URL, trademark);
  }
};
export const reqDeleteTrademark = (id: number) =>
  request.delete<any, any>(API.DELETETRADEMARK_URL + id);
